package game;

import com.golden.gamedev.GameObject;
import com.golden.gamedev.object.Sprite;

public class Treasure extends Sprite
{
	
	TowerDefense myOwner;

	int hitpoints;

	public Treasure(TowerDefense owner, double x, double y)
	{
		super(owner.getImage("resources/treasure.png"), x, y);
		
		hitpoints = 100;
	}
	
	/**
	 * Damage the treasure by a certain amount.
	 * @param dmg
	 */
	public void damage(int dmg)
	{
		hitpoints -= dmg;
	}
	
	public void update(long elapsedTime)
	{
		/*
		 * If the treasure has no more hitpoints, then it's dead.
		 */
		if(hitpoints <= 0)
		{
			setActive(false);
			myOwner.treasureCount--;
		}
	}

}
